<?php $this->Html->script("get_parent_category.js", array('inline' => false)); ?>
<div class="col-md-3">
    <h2><kbd><?php echo __('Actions'); ?></kbd></h2>
    <hr/>
    <ul class="nav navbar-inverse">

        <li><?php echo $this->Form->postLink(__('Delete'), array('action' => 'delete', $this->Form->value('Category.id')), null, __('Are you sure you want to delete # %s?', $this->Form->value('Category.id'))); ?></li>
        <li><?php echo $this->Html->link(__('List Categories'), array('action' => 'index')); ?></li>
        <li><?php echo $this->Html->link(__('List Users'), array('controller' => 'users', 'action' => 'index')); ?> </li>
        <li><?php echo $this->Html->link(__('New User'), array('controller' => 'users', 'action' => 'add')); ?> </li>
        <li><?php echo $this->Html->link(__('List Categories'), array('controller' => 'categories', 'action' => 'index')); ?> </li>
        <li><?php echo $this->Html->link(__('New Parent Category'), array('controller' => 'categories', 'action' => 'add')); ?> </li>
        <li><?php echo $this->Html->link(__('List Transactions'), array('controller' => 'transactions', 'action' => 'index')); ?> </li>
        <li><?php echo $this->Html->link(__('New Transaction'), array('controller' => 'transactions', 'action' => 'add')); ?> </li>
    </ul>
</div>
<div class="categories form col-md-9">
    <?php echo $this->Form->create('Category', array('class' => 'form-horizontal', 'inputDefaults' => array('label' => false))); ?>
    <fieldset>
        <h2><kbd><?php echo __('Edit Category'); ?></kbd></h2>
        <hr/>
        <div class="form-group">
            <label class="col-md-3 control-label">Name Category</label>

            <div class="col-md-4">
                <?php echo $this->Form->input('name', array('class' => 'form-control')) ?>
            </div>
        </div>

        <div class="form-group">
            <label class="col-md-3 control-label">Description</label>

            <div class="col-md-4">
                <?php echo $this->Form->input('description', array('class' => 'form-control')); ?>
            </div>
        </div>

        <div class="form-group">
            <label class="col-md-3 control-label">Type</label>

            <div class="col-md-4">
                <?php
                if ($Category['Category']['type'] == 0) {
                    $id = 1;
                } else {
                    $id = 2;
                }
                $options = array('1' => 'Spent on', '2' => 'Earn from');
                echo $this->Form->input('type', array('class' => 'form-control', 'options' => $options, 'default' => $id));
                ?>
            </div>
        </div>
        <div class="form-group">
            <label class="col-md-3 control-label">Parent</label>

            <div class="col-md-4">
                <?php
                $option = array();
                foreach ($parentCategory as $key => $value) {
                    $option[$key] = $value;
                }

                echo $this->Form->input('parent_id', array('class' => 'form-control', 'options' => $option, 'empty' => '-- No Parent --'));
                ?>
            </div>
        </div>


        <div class="form-group">
            <div class="col-sm-4 col-sm-offset-2">
                <?php echo $this->Form->Submit('Submit', array('class' => 'btn btn-danger')) ?>
            </div>
        </div>
    </fieldset>
    <?php echo $this->Form->end(); ?>
</div>

